import JSEncrypt from 'jsencrypt/bin/jsencrypt.min'

// 密钥对生成 http://web.chacuo.net/netrsakeypair

const publicKeyString =
  'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCLX6V9R2JyGkv7UGsoPvhw/BXVgBWkaN37xT6USmeLGzAW0itLzbPtBt8ZY1JFOKnnNc/NkcGUi2o21mFhpmkKEtyRzmPFd2LLqmQ1rMCXd7Z6P+XWzavzKoacHTJzvS7tIx9vwbbTylrMpcD4JL7EQp8+oMUC/bnS/lv/94qA1QIDAQAB'
// 加密
export function encrypt(txt: string) {
  const encryptor = new JSEncrypt()
  encryptor.setPublicKey(publicKeyString) // 设置公钥
  return encryptor.encrypt(txt) // 对数据进行加密
}
